package home_8_12;

import java.util.Arrays;

/**
 * 给定一个有9个整数（1,6,2,3,9,4,5,7,8）的数组，先排序，然后输出排序后的数组的值。
 */
public class HOME03 {
    public static void main(String[] args) {
        int[] x = {1,6,2,3,9,4,5,7,8};
        System.out.println(Arrays.toString(paixu(x)));
    }
    public static int[] paixu(int[] nums){
        for (int i = 1; i < nums.length ; i++) {
            for (int j = 0; j < nums.length-i ; j++) {
                if (nums[j]>nums[j+1]){
                    int t = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = t;
                }
            }
        }

        return nums;

    }
}
